﻿using System;

using RexToy.UI.WinForm.Pmlx;

namespace RexToy.UI.WinForm.Controls
{
    public static class ThrowHelper
    {
        public static void ThrowTemplateError(PmlxNode node)
        {
            throw new ControlTemplateException(string.Format("Unexpected pmlx content in [{0}:{1}] node.", node.Prefix, node.LocalName));
        }

        public static void ThrowUnexpectedType(Type expected, Type actual)
        {
            throw new ControlTemplateException(string.Format("Unexpected type [{0}](Expect: [{1}]).", actual, expected));
        }

        public static void ThrowMustBindExpression()
        {
            throw new ControlTemplateException("Expect an expression in #{} or ${}.");
        }

        public static void ThrowNotEnumException(Type type)
        {
            throw new ArgumentOutOfRangeException(string.Format("[{0}] is not enum type.", type));
        }
    }
}
